<template>
	<view>
		<!-- status：1：待付款; 2:待核销；3:待发货；4：待收货；5：待评价 6:待配送-->
		<view class="one u-auto u-flex">
			<view class="u-p-l-100" v-if="1>2">
				<!-- 待分享 -->
				<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img4.png' width='76rpx' height='76rpx' v-if="userinfo.status==1"></u-image>
				<!-- 待核销 -->
				<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img4.png' width='76rpx' height='76rpx' v-if="userinfo.status==2"></u-image>
				<!-- 待发货 -->
				<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img4.png' width='76rpx' height='76rpx' v-if="userinfo.status==3"></u-image>
				<!-- 待收货 -->
				<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img4.png' width='76rpx' height='76rpx' v-if="userinfo.status==4"></u-image>
				<!-- 待评价 -->
				<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img25.png' width='76rpx' height='76rpx' v-if="userinfo.status==5"></u-image>
				<!-- 待评价 -->
				<!-- <u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img28.png' width='76rpx' height='76rpx' v-if="status==6"></u-image> -->
			</view>
			<view class="u-p-l-30 cl_FFF">
				
				<view  v-if="userinfo.status==1">已支付</view>
				<view  v-if="userinfo.status==2">已支付</view>
				<view  v-if="userinfo.status==3">待发货</view>
				<view  v-if="userinfo.status==4">待收货</view>
				<view  v-if="userinfo.status==5">待评价</view>
				<view  v-if="userinfo.status==6">已完成</view>
				<!-- <view class="u-m-t-10 u-weight" v-if="status==6">等待商家配送</view> -->

				<view class="u-m-t-10 u-font-20">订单时间:{{userinfo.create_time}}</view>
				<view class="u-m-t-10 u-font-20">订单编号:{{userinfo.order_sn}}</view>
			</view>
		</view>
		<!-- 贡献值 -->
		<view class="u-p-20">
			<view class="u-b-r-16" style="background-color:#ffffff;padding: 30rpx 20rpx;">
				<view class="u-flex u-row-between" @click="getWin(userinfo,1)">
					<view class="u-weight">贡献值进度:</view>
					<view class="u-flex">
						<view class="u-font-20" style="color: #FC3533;">查看详情</view>
						<u-icon name='arrow-right' color='#FC3533'></u-icon>
					</view>
				</view>
				<view class="u-flex u-m-t-20" >
					<view class="u-w-500 u-m-l-20">
						<u-line-progress active-color="#FF5502"  :percent="(Number(((userinfo.all_conval/userinfo.con_val)*100).toFixed(2)))"></u-line-progress>
					</view>
				</view>
				<view class="u-flex u-m-t-20">
					<view class="">所需贡献值:</view>
					<view class="" style="color: #FF5502;">{{userinfo.con_val}}</view>
				</view>
				<view class="u-flex u-font-20 u-m-t-20">
					
					<view class="u-flex ">
						<view class="">已累计贡献值:</view>
						<view class="" style="color: #FF5502;">{{userinfo.all_conval}}</view>
					</view>
					<view class="u-flex u-m-l-20">
						<view class="">剩余贡献值:</view>
						<view class="" style="color: #FF5502;">{{Number(userinfo.con_val-userinfo.all_conval).toFixed(2)}}</view>
					</view>
				</view>

				<view class="u-p-20">
					<view class="" style="color: #FC3533;text-align: right;">合计:￥{{userinfo.total_amount}}</view>
					<view class=" u-m-t-30">
						<u-row justify='end'>
							
							<u-col :span='3'>
								<view class="u-b-r-10 u-w-160 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color: #FC3533;padding: 4rpx 10rpx;"
									@click="getWin(userinfo,2)">获取贡献值</view>
							</u-col>

						</u-row>
					</view>
				</view>
			</view>
		</view>
		<!-- 物流状态 -->
		<view class="u-p-30" v-if="userinfo.status!=1">
			<view class="bg_FFFFFF u-p-20 u-b-r-16">
				<view class="u-flex u-row-between">
					<view class="u-weight">物流信息</view>
					<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img2.png' width='25rpx' height='25rpx'
						@click="$u.route('/subcontract/originalprice/logistics/logistics')"></u-image>
				</view>

				<view class="u-m-t-20 u-flex">
					<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img12.png' width='37rpx' height='37rpx'></u-image>
					<view class=" u-m-l-20 u-font-20">
						<view class="">已揽件</view>
						<view class="u-m-t-20 " style="color: #898989;">2021-07-18 02:15:09</view>
					</view>
				</view>
			</view>
		</view>

		<!-- 收货人信息 -->
		<view v-if="userinfo.status!=2" class="u-p-30">
			<view  class="bg_FFFFFF u-p-20 u-b-r-16">
				<view class="u-flex u-row-between u-p-b-20">
					<view class="u-weight">收货人信息</view>
					<view class="u-flex" @click="copy">
						<view class="u-font-24 u-m-l-10" style="color: #FF5502;">复制信息</view>
					</view>
				</view>
				<view class="u-flex">
					<view class="u-flex">
						<view class="">收货人:</view>
						<view class="u-m-l-20">{{userinfo.addressee_name}}</view>
					</view>
					<view class="u-flex u-m-l-30">
						<view class="">电话:</view>
						<view class="u-m-l-20">{{userinfo.addressee_telphone}}</view>
					</view>
				</view>
				<view class="u-m-t-20 u-l-h-48 u-p-b-20" style="border-bottom: 1rpx solid #F4F1F1;">{{userinfo.address}}
				</view>
			</view>
		</view>
		<view class="u-p-30" v-else>
			<view class="bg_FFFFFF u-p-20 u-font-28 u-b-r-16">
				<view class="u-flex">
					<view class="">店铺名称:</view>
					<view class="u-m-l-20">{{userinfo.shop_name}}</view>
				</view>
				<view class="u-flex u-m-t-10">
					<view class="">店铺电话:</view>
					<view class="u-m-l-20">{{userinfo.shop_mobile}}</view>
				</view>
				<view class="u-m-t-10">
					<view class="">店铺地址:</view>
					<view class="u-m-t-10">{{userinfo.shop_address}}</view>
				</view>
			</view>
		</view>

		<view class="u-p-30">
			<view class="u-p-20 u-b-r-16 bg_FFFFFF">
				<view class="u-flex u-p-20" style="border-bottom: 1rpx solid #F4F1F1;">
					<u-image :src='userinfo.shop_logo' width='36rpx' height='36rpx'></u-image>
					<view class="u-p-l-10 u-weight u-h-36">{{userinfo.shop_name}}</view>
				</view>
				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;"
					v-for="(item,index) in userinfo.item" :key="index">
					<view class="u-flex" @click="$u.route(`/pages/home/paymassage?num=${item.spu}`)">
						<view class="">
							<u-image :src='item.imgs[0]' width='183rpx' height='183rpx'></u-image>
						</view>
						<view class="u-p-l-10 ">
							<view class="u-weight">{{item.goods_name}}</view>
							<!-- <view class="u-weight u-p-t-10">可口30克*12枚</view> -->
							<view class="u-font-20  u-m-t-10"
								style="background-color: #F8F8F8; color: #68615F;padding: 3rpx 6rpx;display: inline-block;">
								{{item.spece_value_id}}</view>
							<view class="u-flex u-row-between u-w-400">
								<view class=" u-p-t-10" style="color: #FC3533;">￥{{item.price}}</view>
								<view class="u-font-28" style="color:#454545;">{{item.num}}</view>
							</view>
		
						</view>
		
					</view>
		
				</view>
				<view class="u-m-t-20 u-flex u-row-between">
					<view class="">备注：</view>
					<view class="u-weight">{{userinfo.note}}</view>
				</view>
				<view class="u-m-t-20 u-flex u-row-between">
					<view class="">运费</view>
					<view class="u-weight">{{userinfo.delivery_amount}}</view>
				</view>
				<view class="u-m-t-20 u-flex u-row-between">
					<view class="">抵扣金抵扣</view>
					<view class="u-weight">{{userinfo.deduct_amount}}元</view>
				</view>
				<view class="u-m-t-20 u-flex u-row-between">
					<view class="">实付金额</view>
					<view class="u-weight">{{userinfo.pay_amount}}元</view>
				</view>
				<view class="u-m-t-20 u-flex u-row-between">
					<view class="">总金额</view>
					<view class="u-weight">{{userinfo.total_amount}}元</view>
				</view>
			</view>
		</view>

		<view class="" style="padding:30rpx;">
			<view class="bg_FFFFFF u-p-20 u-b-r-16">
				<view class="u-weight u-font-30">订单详情</view>
				<view class="u-m-t-20 u-flex" style="color: #68615F;">
					<view class="">发货方式：</view>
					<view class="u-m-l-20">{{userinfo.transport_type==2?'到店自提':'邮寄发货'}}</view>
				</view>
				<view class="u-m-t-20 u-flex" style="color: #68615F;">
					<view class="">订单编号：</view>
					<view class="u-m-l-20">{{userinfo.order_sn}}</view>
				</view>
				<view class="u-m-t-20 u-flex" style="color: #68615F;" v-if="userinfo.status!=0">
					<view class="">支付方式：</view>
					<view class="u-m-l-20">{{userinfo.pay_type}}</view>
				</view>
				<view class="u-m-t-20 u-flex" style="color: #68615F;">
					<view class="">支付交易号</view>
					<view class="u-m-l-20">{{userinfo.order_sn}}</view>
				</view>
				<view class="u-m-t-20 u-flex" style="color: #68615F;">
					<view class="">创建时间：</view>
					<view class="u-m-l-20">{{userinfo.create_time}}</view>
				</view>
				<view v-if="userinfo.complete_time" class="u-m-t-20 u-flex" style="color: #68615F;">
					<view class="">收货时间：</view>
					<view class="u-m-l-20">{{userinfo.complete_time}}</view>
				</view>
				<view v-if="userinfo.send_time" class="u-m-t-20 u-flex" style="color: #68615F;">
					<view class="">发货时间：</view>
					<view class="u-m-l-20">{{userinfo.send_time}}</view>
				</view>
			</view>
		</view>
		<view v-if="1>2" class="u-fix u-b-0 bg_FFFFFF  u-w-750" style="padding: 30rpx 20rpx;">
			<u-row justify='end'>

				<u-col :span='4' v-if="userinfo.status==1 || userinfo.status==3">
					<view class="u-b-r-10   u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center"
						style="border: 1rpx solid #FC3533;color: #FC3533;" @click="remove_good(item.id)">结束订单</view>
				</u-col>
				<u-col :span='4' v-if="status==1">
					<view class="u-b-r-10  u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center cl_FFF"
						style="background-color: #FC3533;" @click="show6=true">优先订单</view>
				</u-col>
				<!-- <u-col :span='4' v-if="status==3||status==2">
					<view class="u-b-r-10   u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center"
						style="border: 1rpx solid #FC3533;color: #FC3533;" @click="show=true">取消订单</view>
				</u-col> -->
				<u-col :span='4' v-if="status==2">
					<view class="u-b-r-10  u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center cl_FFF"
						style="background-color: #FC3533;" @click="show4=true">查看二维码</view>
				</u-col>
				<!-- <u-col :span='4' v-if="status==4||status==5||status==6">
					<view class="u-b-r-10   u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center"
						style="border: 1rpx solid #FC3533;color: #FC3533;" @click="show2=true">申请售后</view>
				</u-col> -->
				<u-col :span='4' v-if="status==5">
					<view class="u-b-r-10   u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center"
						style="border: 1rpx solid #FC3533;color: #FC3533;" @click="show3=true">查看发票</view>
				</u-col>
				<u-col :span='4' v-if="status==4||status==6">
					<view class="u-b-r-10   u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center"
						style="border: 1rpx solid #FC3533;color: #FC3533;"
						@click="$u.route('/subcontract/originalprice/Invoicing/Invoicing')">申请开票</view>
				</u-col>
				<u-col :span='4' v-if="status==4||status==6">
					<view class="u-b-r-10  u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center cl_FFF"
						style="background-color: #FC3533;">确认收货</view>
				</u-col>
				<u-col :span='4' v-if="status==5">
					<view class="u-b-r-10  u-w-210 u-l-h-90 u-h-90 u-font-30 u-text-center cl_FFF"
						style="background-color: #FC3533;"
						@click="$u.route('/subcontract/originalprice/evaluate/evaluate')">去评价</view>
				</u-col>
			</u-row>
		</view>
<!-- 结束订单 -->
		<u-mask :show="show1">
			<view class="u-w-600 u-auto u-m-t-160">
				<view class="u-abso" style="left: 400rpx;top: 250rpx;">
					<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/spc.png" mode="aspectFill" width="216rpx" height='274rpx'>
					</u-image>
				</view>
				<view class=" u-p-30 bg_FFFFFF u-b-r-16" style="margin-top: 400rpx;">
					<view class="u-font-50 u-weight">结束订单</view>
				
				
					<view class="">
						<view class="u-p-t-30 u-font-20">贡献值已完成，取消订单请确认以下信息</view>
						<view class="u-p-t-20 u-font-20 u-l-h-48">
							结束订单后该订单不予退款，发放实付金额
							相等的积分+获取到的贡献值X50%至积分
							账户中
						</view>
				
					</view>
					<view class="u-flex u-m-t-20">
						<view @click="show1=false"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto  u-b-r-20"
							style="background-color: #FFEAEAFF;color: #FC3533FF;">我再想想</view>
				
						<view @click="true_remove_list"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto cl_FFF u-b-r-20"
							style="background-color: #FC3533FF;">确认</view>
				
					</view>
				
				</view>
			</view>
			
		</u-mask>
		
		<!-- 优先订单 -->
		<u-mask :show="show6">
			<view class="u-w-600 u-auto u-m-t-160">
				<view class="u-abso" style="left: 400rpx;top: 250rpx;">
					<u-image src="https://www.sqkjkj.vip/wxImg/contribution/img7.png" mode="aspectFill" width="216rpx" height='274rpx'>
					</u-image>
				</view>
				<view class=" u-p-40 bg_FFFFFF u-b-r-16" style="margin-top: 400rpx;">
					<view class="u-font-50 u-weight">优先订单</view>
				<view class="">
						
						<view class="u-p-t-40 u-font-20 u-l-h-48">
							选择为优先订单后，
							平台优先分配贡献值给此订单
						</view>
				
					</view>
					<view class="u-flex u-m-t-20">
						<view @click="show6=false"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto  u-b-r-20"
							style="background-color: #FFEAEAFF;color: #FC3533FF;">取消</view>
				
						<view @click="show6=false"
							class="u-w-200 u-m-t-20 u-h-92 u-l-h-92 u-font-30 u-text-center u-auto cl_FFF u-b-r-20"
							style="background-color: #FC3533FF;">提交</view>
				
					</view>
				
				</view>
			</view>
			
		</u-mask>
		<!-- 申请售后 -->
		<u-mask :show="show2" @click='show2=false'>
			<view class="u-w-600 u-b-r-20 bg_FFFFFF u-p-30 u-auto " style="margin-top: 300rpx;">

				<view class="u-flex u-row-between u-p-b-40" style="border-bottom: 1rpx solid #DFDFDF;">
					<view class="">我要退款(未收到货)</view>
					<view class="" @click="$u.route('/subcontract/originalprice/returngoods/returngoods?num=1')">
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img7.png' width='28rpx' height='28rpx'></u-image>
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img23.png' width='28rpx' height='28rpx'></u-image>
					</view>
				</view>

				<view class="u-flex u-row-between u-m-t-30">
					<view class="">我要退款(未收到货)</view>
					<view class="" @click="$u.route('/subcontract/originalprice/returngoods/returngoods?num=2')">
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img7.png' width='28rpx' height='28rpx'></u-image>
						<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img23.png' width='28rpx' height='28rpx'></u-image>
					</view>
				</view>
			</view>
		</u-mask>
		<!-- 查看发票 -->
		<u-mask :show="show3">
			<view class="u-p-30">
				<view class="bg_FFFFFF u-b-r-20 u-auto u-m-t-200 u-p-20">
					<view class="u-flex u-row-center u-p-t-50">
						<view class="u-h-30">
							<u-image src='https://www.sqkjkj.vip/wxImg/mybag/img6.png' width='15rpx' height='22rpx'></u-image>
						</view>

						<view class="" style="padding: 0 20rpx;">查看发票</view>
						<view class="u-h-30 u-weight">
							<u-image src='https://www.sqkjkj.vip/wxImg/mybag/img6.png' width='15rpx' height='22rpx'></u-image>
						</view>
					</view>


					<view class="u-m-l-40 u-m-t-70 u-w-600 u-flex-col u-col-center">
						<u-image src='https://www.sqkjkj.vip/wxImg/common/img/zz.jpg' width='466rpx' height='316rpx'></u-image>
					</view>



					<view @click="saves" class="u-w-460 u-auto u-m-t-30 u-b-r-20 u-h-94 u-text-center u-l-h-94 cl_FFF"
						style="background-color:#FC3533 ;">保存图片</view>

				</view>

				<view class="error" @click="show3 = false" style="margin-left: 300rpx;">
					<!-- <u-image src="https://www.sqkjkj.vip/wxImg/common/home/img12.png" mode="aspectFill" width="74rpx" height='160rpx'></u-image> -->
				</view>
			</view>

		</u-mask>
		<!-- 待核销 -->
		<u-mask :show="show4">
			<view class="ones u-auto u-m-t-130 u-p-20">
				<view class="u-flex u-row-center u-p-t-50">
					<view class="u-h-30">
						<u-image src='https://www.sqkjkj.vip/wxImg/mybag/img6.png' width='15rpx' height='22rpx'></u-image>
					</view>

					<view class="" style="padding: 0 20rpx;">查看二维码</view>
					<view class="u-h-30 u-weight">
						<u-image src='https://www.sqkjkj.vip/wxImg/mybag/img6.png' width='15rpx' height='22rpx'></u-image>
					</view>
				</view>

				<view class="u-m-t-60 u-font-20 u-text-center" style="color: #454545;">核销码</view>
				<view class="u-m-t-60 u-font-40 u-weight u-text-center" style="color: #454545;">NKF51515</view>
				<view class="u-h-314 u-m-t-20 u-auto u-w-314 u-b-r-6 u-p-10" style="border: 3rpx solid #FB772D;">
					<view class="u-m-l-10 u-m-t-10">
						<u-image src='https://www.sqkjkj.vip/wxImg/common/img/zz.jpg' width='266rpx' height='266rpx'></u-image>
					</view>

				</view>

				<view @click="saves" class="u-w-460 u-auto u-m-t-30 u-b-r-20 u-h-94 u-text-center u-l-h-94 cl_FFF"
					style="background-color:#FC3533 ;">保存图片</view>

			</view>

			<view class="error" @click="show4 = false" style="margin-left: 350rpx;">
				<!-- <u-image src="https://www.sqkjkj.vip/wxImg/common/home/img12.png" mode="aspectFill" width="74rpx" height='160rpx'></u-image> -->
			</view>
		</u-mask>
		
		<!-- 取消订单 -->
		<u-picker mode="selector" v-model="show5" :default-selector="[0]" :range="no_lick_list" @confirm='true_remove_good'></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 订单状态
				status: '',
				// 备注信息
				massage: '',
				// 点击取消订单
				show: false,
				// 结束订单
				show1: false,
				// 是否为默认地址
				num: 0,
				// 申请售后
				show2: false,
				// 查看发票
				show3: false,
				// 待核销
				show4: false,
				// 优先订单
				show6:false,
				userinfo:'',
				order_id:'',
				show5:false,
				no_lick_list: [],
			}
		},
		onLoad(obj) {
			console.log(obj);
			this.status = obj.num
			console.log(this.status);
			this.massage_detail()
	
		},
		methods: {
			massage_detail() {
				this.$api.people_pay_list_detal({
					order_sn: this.status
				}, res => {
					this.userinfo = res.data.data
				})
			},
			
			// 点击取消订单
			remove_good(obj) {
				this.order_id = obj
				
				this.show1 = true
			},
			// 点击确定
			true_remove_list(){
				// 获取原因
				this.$api.get_good_get({}, res => {
					console.log(res);
					this.no_lick_list = res.data.data
				})
				this.show5=true
				this.show1=false
				
			},
			// 点击确定取消按钮
			true_remove_good(e) {
				console.log(e);
				// let arr=
				console.log(this.no_lick_list[e[0]]);
				this.$api.remove_pay_list_detal({
					order_id: this.order_id,
					order_cancel_cause:this.no_lick_list[e[0]],
					remark_reason:''
				}, res => {
					console.log(res);
					if (res.data.code == 1) {
						uni.showToast({
							icon: 'success',
							title: '取消成功'
						})
						this.massage()
						this.show5 = false
					} else {
						uni.showToast({
							icon: 'error',
							title: res.data.msg
						})
					}
				})
			},
					
			// 保存图片
			saves() {

			},
			getWin(item,type){
				uni.setStorageSync('winList',item)
				this.$u.route(`${type==1?'/subcontract/halfprice/contribution/contribution':'/subcontract/halfprice/get/get'}`)
			},
			// 点击复制
			copy(item) {
				uni.setClipboardData({
					data:`${this.userinfo.addressee_name} ${this.userinfo.addressee_telphone} ${this.userinfo.address}`,
					success: function() {
						console.log('success');
					}
				});
			},
		}
	}
</script>

<style scoped>
	page {
		background-color: #f5f5f5;
	}

	.one {
		margin-top: 20rpx;
		width: 710rpx;
		height: 213rpx;
		background: url('https://www.sqkjkj.vip/wxImg/orderlist/img3.png') no-repeat;
		background-size: 100% 100%;
	}

	.bgc {
		background: #F4F4F4;
	}

	.bgc1 {
		background: #FFF2F2;
		border: 1rpx solid #FC3533;
	}

	.error {
		width: 74rpx;
		height: 160rpx;
		background: url('https://www.sqkjkj.vip/wxImg/common/home/img12.png') no-repeat;
		background-size: 100% 100%;
	}

	.ones {
		width: 503rpx;
		height: 883rpx;
		background: url('https://www.sqkjkj.vip/wxImg/mybag/img5.png') no-repeat;
		background-size: 100% 100%;
	}
</style>
